package com.lovehena.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

// getUrl(settings) + "/app/person/auth/person/auth/init
@RestController
@RequestMapping("/app/person/auth/person/auth")
public class VerifyController {
    /*
    * if (0 == Util.getIntValue(data.get("code") + "", -1)) {
                Map<String, Object> result = (Map<String, Object>) data.get("result");
                String authId = Util.null2String(result.get("authId"));
                String authUrl = Util.null2String(result.get("authUrl"));
                String authType = Util.null2String(result.get("authType")) ;
                String errorFlag = Util.null2String(result.get("errorFlag")) ;
                if(StringUtils.isBlank(authType)){
                    authType = "FACE" ;
                }
                if("true".equals(errorFlag)) {
                    rs.executeUpdate("insert into hrm_qyslogin_log(authId,url,req_params,req_header,resp_params,ts) values (?,?,?,?,?,?)",
                            authId, authUrl, JSONObject.toJSONString(params), JSONObject.toJSONString(headerMap), json, DateUtil.getFullDate());
                }
                return new String[]{authId, authUrl,authType,errorFlag};
            } else {
                // 失败
                String msg = Util.null2String(data.get("message")) ;
                throw new CaCheckException("-1", SystemEnv.getHtmlLabelName(534918 ,Util.getDefaultLang()));
            }
    * */
    @PostMapping("/init")
    public Map<String, Object> auth() {
        LinkedHashMap<String, Object> res = new LinkedHashMap<>();


        LinkedHashMap<String, Object> result = new LinkedHashMap<>();
        result.put("authId","authId");
        result.put("authUrl","authUrl");
        result.put("authType","authType");
        result.put("errorFlag","true");

        res.put("code", 0);
        res.put("result",result);
        res.put("message", "校验成功！");
        return res;
    }
}
